home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d16 / winsrc.arc / CMDFILES.C < prev    next >
C/C++ Source or Header  |  1991-06-16  |  54KB  |  1,722 lines

  1.  
  2. /*
  3.     Command-line / Command-File Parser Routines
  4.     This module is linked as an overlay, use ENTER_OVLY and EXIT_OVLY.
  5. */
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <string.h>
  10. #include <float.h>
  11. #include <ctype.h>
  12. #include "fractint.h"
  13. #ifdef __TURBOC__
  14. #include <dir.h>
  15. #endif
  16.  
  17. /* routines in this module    */
  18.  
  19. void cmdfiles_overlay(void);
  20. int  cmdfiles(int argc, char *argv[]);
  21. int  load_commands(FILE *);
  22. void set_3d_defaults(void);
  23.  
  24. static int  cmdfile(FILE *,int);
  25. static int  next_command(char *,int,FILE *,char *,int *,int);
  26. static int  next_line(FILE *,char *,int);
  27. static int  cmdarg(char *,int);
  28. static void argerror(char *);
  29. static void initvars_run(void);
  30. static void initvars_restart(void);
  31. static void initvars_fractal(void);
  32. static void initvars_3d(void);
  33. static void reset_ifs_defn(void);
  34. static void parse_textcolors(char *value);
  35. static int  parse_colors(char *value);
  36. static int  parse_printer(char *value);
  37.  
  38. extern int  makedoc_msg_func(int,int);
  39.  
  40. /* variables defined by the command line/files processor */
  41. char    temp1[256];        /* temporary strings        */
  42. char    readname[80];        /* name of fractal input file */
  43. char    gifmask[13] = {""};
  44. char    PrintName[80];        /* Name for print-to-file */
  45. int    potflag=0;        /* continuous potential enabled? */
  46. int    pot16bit;        /* store 16 bit continuous potential values */
  47. char    savename[80];        /* save files using this name */
  48. char    autoname[80];        /* record auto keystrokes here */
  49. int    gif87a_flag;        /* 1 if GIF87a format, 0 otherwise */
  50. int    askvideo;        /* flag for video prompting */
  51. char    floatflag;
  52. int    biomorph;        /* flag for biomorph */
  53. int    usr_biomorph;
  54. int    forcesymmetry;        /* force symmetry */
  55. int    showfile;        /* zero if file display pending */
  56. int    rflag, rseed;        /* Random number seeding flag and value */
  57. int    decomp[2];        /* Decomposition coloring */
  58. int    distest;
  59. int    distestwidth;
  60. char overwrite = 0;    /* 0 if file overwrite not allowed */
  61. int    soundflag;        /* 0 if sound is off, 1 if on */
  62. int    basehertz;        /* sound=x/y/x hertz value */
  63. int    debugflag;        /* internal use only - you didn't see this */
  64. int    timerflag;        /* you didn't see this, either */
  65. int    cyclelimit;        /* color-rotator upper limit */
  66. int    inside;         /* inside color: 1=blue     */
  67. int    outside;        /* outside color    */
  68. int    finattract;        /* finite attractor logic */
  69. int    display3d;        /* 3D display flag: 0 = OFF */
  70. int    overlay3d;        /* 3D overlay flag: 0 = OFF */
  71. int    init3d[20];        /* '3d=nn/nn/nn/...' values */
  72. int    initbatch;        /* 1 if batch run (no kbd)  */
  73. unsigned initsavetime;        /* autosave minutes        */
  74. double    initorbit[2];        /* initial orbitvalue */
  75. char    useinitorbit;        /* flag for initorbit */
  76. int    initmode;        /* initial video mode        */
  77. int    initcyclelimit;     /* initial cycle limit        */
  78. unsigned char usemag;        /* use center-mag corners   */
  79. int    bailout;        /* user input bailout value */
  80. double    inversion[3];        /* radius, xcenter, ycenter */
  81. int    rotate_lo,rotate_hi;    /* cycling color range        */
  82. int far *ranges;        /* iter->color ranges mapping */
  83. int    rangeslen = 0;        /* size of ranges array     */
  84. char far *mapdacbox = NULL;    /* map= (default colors)    */
  85. int    colorstate;        /* 0, dacbox matches default (bios or map=) */
  86.                 /* 1, dacbox matches no known defined map   */
  87.                 /* 2, dacbox matches the colorfile map        */
  88. int    colorpreloaded;     /* if dacbox preloaded for next mode select */
  89. char    colorfile[80];        /* from last <l> <s> or colors=@filename    */
  90. int    TPlusFlag;        /* Use the TARGA+ if found  */
  91. int    MaxColorRes;        /* Default Color Resolution if available */
  92. int    PixelZoom;        /* TPlus Zoom Level */
  93. int    NonInterlaced;        /* Non-Interlaced video flag */
  94. int    orbitsave = 0;        /* for IFS and LORENZ to output acrospin file */
  95. extern    int invert;
  96. extern int fractype;        /* fractal type         */
  97. extern double param[4];     /* initial parameters        */
  98. extern double xxmin,xxmax;    /* initial corner values    */
  99. extern double yymin,yymax;    /* initial corner values    */
  100. extern double xx3rd,yy3rd;    /* initial corner values    */
  101. extern char usr_stdcalcmode;    /* '1', '2', 'g', 'b'       */
  102. extern int maxit;        /* max iterations        */
  103. extern int usr_periodicitycheck; /* periodicity checking  1=on,0=off */
  104. extern char usr_floatflag;    /* flag for float calcs */
  105. extern int usr_distest;     /* nonzero if distance estimator option */
  106. extern char color_lakes;    /* finite attractor flag */
  107. extern int haze;
  108. extern int RANDOMIZE;
  109. extern int Ambient;
  110. extern int full_color;
  111. extern char light_name[];
  112. extern int BRIEF;
  113. extern int RAY;
  114. extern char back_color[];
  115. extern unsigned char dacbox[256][3];
  116. extern struct videoinfo far videotable[];
  117. extern int fpu;
  118. extern int iit;
  119.  
  120. extern double potparam[];    /* potential parameters  */
  121. extern int Printer_Resolution, LPTNumber,
  122.        Printer_Type, Printer_Titleblock,
  123.        Printer_ColorXlat, Printer_SetScreen,
  124.        Printer_SFrequency, Printer_SAngle,
  125.        Printer_SStyle, EPSFileType,
  126.        Print_To_File,Printer_CRLF;        /* for printer functions */
  127.  
  128. int    transparent[2];     /* transparency min/max values */
  129. int    LogFlag;        /* Logarithmic palette flag: 0 = no */
  130.  
  131. unsigned char exitmode = 3;    /* video mode on exit */
  132.  
  133. extern int video_type;
  134. extern int mode7text;
  135. extern int textsafe;
  136. extern int vesa_detect;
  137.  
  138. extern int   viewwindow;
  139. extern float viewreduction;
  140. extern int   viewcrop;
  141. extern float finalaspectratio;
  142. extern int   viewxdots,viewydots;
  143.  
  144. extern char MAP_name[];
  145. extern int mapset;
  146.  
  147. extern int eyeseparation; /* Occular Separation */
  148. extern int glassestype;
  149. extern int xadjust; /* Convergence */
  150. extern int yadjust;
  151. extern int xtrans, ytrans; /* X,Y shift with no perspective */
  152. extern int red_crop_left, red_crop_right;
  153. extern int blue_crop_left, blue_crop_right;
  154. extern int red_bright, blue_bright;
  155. extern char showbox; /* flag to show box and vector in preview */
  156. extern char preview;        /* 3D preview mode flag */
  157. extern int previewfactor; /* Coarsness */
  158.  
  159. int first_init=1;        /* first time into cmdfiles? */
  160. static int init_rseed;
  161. static char initcorners,initparams;
  162. struct fractalspecificstuff far *curfractalspecific;
  163.  
  164. char FormFileName[80];        /* file to find (type=)formulas in */
  165. char FormName[ITEMNAMELEN+1];    /* Name of the Formula (if not null) */
  166. char LFileName[80];        /* file to find (type=)L-System's in */
  167. char LName[ITEMNAMELEN+1];    /* Name of L-System */
  168. char CommandFile[80];        /* file to find command sets in */
  169. char CommandName[ITEMNAMELEN+1];/* Name of Command set */
  170. char CommandComment1[57];    /* comments for command set */
  171. char CommandComment2[57];
  172. char IFSFileName[80];        /* file to find (type=)IFS in */
  173. char IFSName[ITEMNAMELEN+1];    /* Name of the IFS def'n (if not null) */
  174. float far *ifs_defn = NULL;    /* ifs parameters */
  175. int  ifs_changed;        /* nonzero if parameters have been edited */
  176. int  ifs_type;            /* 0=2d, 1=3d */
  177. int  slides = 0;        /* 1 autokey=play, 2 autokey=record */
  178.  
  179. unsigned char txtcolor[]={
  180.       BLUE*16+L_WHITE,      /* C_TITLE           title background */
  181.       BLUE*16+L_GREEN,      /* C_TITLE_DEV       development vsn foreground */
  182.       GREEN*16+YELLOW,      /* C_HELP_HDG        help page title line */
  183.       WHITE*16+BLACK,      /* C_HELP_BODY       help page body */
  184.       GREEN*16+GRAY,      /* C_HELP_INSTR      help page instr at bottom */
  185.       WHITE*16+BLUE,      /* C_HELP_LINK       help page links */
  186.       CYAN*16+BLUE,      /* C_HELP_CURLINK    help page current link */
  187.       WHITE*16+GRAY,      /* C_PROMPT_BKGRD    prompt/choice background */
  188.       WHITE*16+BLACK,      /* C_PROMPT_TEXT     prompt/choice extra info */
  189.       BLUE*16+WHITE,      /* C_PROMPT_LO       prompt/choice text */
  190.       BLUE*16+L_WHITE,      /* C_PROMPT_MED      prompt/choice hdg2/... */
  191.       BLUE*16+YELLOW,      /* C_PROMPT_HI       prompt/choice hdg/cur/... */
  192.       GREEN*16+L_WHITE,   /* C_PROMPT_INPUT    fullscreen_prompt input */
  193.       CYAN*16+L_WHITE,      /* C_PROMPT_CHOOSE   fullscreen_prompt choice */
  194.       MAGENTA*16+L_WHITE, /* C_CHOICE_CURRENT  fullscreen_choice input */
  195.       BLACK*16+WHITE,      /* C_CHOICE_SP_INSTR speed key bar & instr */
  196.       BLACK*16+L_MAGENTA, /* C_CHOICE_SP_KEYIN speed key value */
  197.       WHITE*16+BLUE,      /* C_GENERAL_HI      tab, thinking, IFS */
  198.       WHITE*16+BLACK,      /* C_GENERAL_MED */
  199.       WHITE*16+GRAY,      /* C_GENERAL_LO */
  200.       BLACK*16+L_WHITE,   /* C_GENERAL_INPUT */
  201.       WHITE*16+BLACK,      /* C_DVID_BKGRD      disk video */
  202.       BLACK*16+YELLOW,      /* C_DVID_HI */
  203.       BLACK*16+L_WHITE,   /* C_DVID_LO */
  204.       RED*16+L_WHITE,      /* C_STOP_ERR        stop message, error */
  205.       GREEN*16+BLACK,      /* C_STOP_INFO       stop message, info */
  206.       BLUE*16+WHITE,      /* C_TITLE_LOW       bottom lines of title screen */
  207.       GREEN*16+BLACK,      /* C_AUTHDIV1        title screen dividers */
  208.       GREEN*16+GRAY,      /* C_AUTHDIV2        title screen dividers */
  209.       BLACK*16+L_WHITE,   /* C_PRIMARY           primary authors */
  210.       BLACK*16+WHITE      /* C_CONTRIB           contributing authors */
  211.       };
  212.  
  213. extern int active_system;
  214.  
  215.  
  216. void cmdfiles_overlay() { }    /* for restore_active_ovly */
  217.  
  218. /*
  219.     cmdfiles(argc,argv) process the command-line arguments
  220.         it also processes the 'sstools.ini' file and any
  221.         indirect files ('fractint @myfile')
  222. */
  223.  
  224. int cmdfiles(int argc,char *argv[])
  225. {
  226.    int       i, j, k, l;
  227.    char    curarg[141];
  228.    char    tempstring[101];
  229.    char    *sptr;
  230.    FILE    *initfile;
  231.  
  232.    ENTER_OVLY(OVLY_CMDFILES);
  233.  
  234.    if (first_init) initvars_run();    /* once per run initialization */
  235.    initvars_restart();            /* <ins> key initialization */
  236.    initvars_fractal();            /* image initialization */
  237.  
  238.    findpath("sstools.ini", tempstring); /* look for SSTOOLS.INI */
  239.    if (tempstring[0] != 0)        /* found it! */
  240.       if ((initfile = fopen(tempstring,"r")) != NULL)
  241.      cmdfile(initfile,1);        /* process it */
  242.  
  243.    for (i = 1; i < argc; i++) {     /* cycle through args */
  244.       strcpy(curarg,argv[i]);
  245.       if (curarg[0] == ';')             /* start of comments? */
  246.      break;
  247.       if (curarg[0] != '@') {           /* simple command? */
  248.      if (strchr(curarg,'=') == NULL) { /* not xxx=yyy, so check for gif */
  249.         strcpy(tempstring,curarg);
  250.         if (strchr(curarg,'.') == NULL)
  251.            strcat(tempstring,".gif");
  252.         if ((initfile = fopen(tempstring,"rb"))) {
  253.            fread(tempstring,6,1,initfile);
  254.            if ( tempstring[0] == 'G'
  255.          && tempstring[1] == 'I'
  256.          && tempstring[2] == 'F'
  257.          && tempstring[3] >= '8' && tempstring[3] <= '9'
  258.          && tempstring[4] >= '0' && tempstring[4] <= '9') {
  259.           strcpy(readname,curarg);
  260.           curarg[0] = showfile = 0;
  261.           }
  262.            fclose(initfile);
  263.            }
  264.         }
  265.      if (curarg[0])
  266.         cmdarg(curarg,0);        /* process simple command */
  267.      }
  268.       else if ((sptr = strchr(curarg,'/'))) { /* @filename/setname? */
  269.      *sptr = 0;
  270.      strcpy(CommandFile,&curarg[1]);
  271.      strcpy(CommandName,sptr+1);
  272.      find_file_item(CommandFile,CommandName,&initfile);
  273.      cmdfile(initfile,3);
  274.      }
  275.       else {                /* @filename */
  276.      if ((initfile = fopen(&curarg[1],"r")) == NULL)
  277.         argerror(curarg);
  278.      cmdfile(initfile,0);
  279.      }
  280.       }
  281.  
  282.    if (first_init == 0) {
  283.       initmode = -1; /* don't set video when <ins> key used */
  284.       showfile = 1;  /* nor startup image file            */
  285.       }
  286.  
  287.    first_init = 0;
  288.    EXIT_OVLY;
  289.    return(0);
  290. }
  291.  
  292.  
  293. int load_commands(FILE *infile)
  294. {
  295.    /* when called, file is open in binary mode, positioned at the */
  296.    /* '(' or '{' following the desired parameter set's name       */
  297.    int ret,c;
  298.    ENTER_OVLY(OVLY_CMDFILES);
  299.    initcorners = initparams = 0; /* reset flags for type= */
  300.    ret = cmdfile(infile,2);
  301.    EXIT_OVLY;
  302.    return ret;
  303. }
  304.  
  305.  
  306. static void initvars_run()        /* once per run init */
  307. {
  308.    init_rseed = (int)time(NULL);
  309. /* after v16, move following initializations to static init */
  310.    strcpy(savename,"fract001");         /* initial save filename  */
  311.    strcpy(light_name,"light001.tga");   /* initial light filename */
  312.    strcpy(PrintName,"fract001.prn");    /* initial print-to-file  */
  313.    strcpy(autoname,"auto.key");         /* initial auto filename  */
  314. }
  315.  
  316. static void initvars_restart()        /* <ins> key init */
  317. {
  318.    gif87a_flag = 0;            /* turn on GIF89a processing */
  319.    askvideo = 1;            /* turn on video-prompt flag */
  320.    overwrite = 0;            /* don't overwrite           */
  321.    soundflag = -1;            /* sound is on             */
  322.    basehertz = 440;            /* basic hertz rate         */
  323.    initbatch = 0;            /* not in batch mode         */
  324.    initsavetime = 0;            /* no auto-save          */
  325.    initmode = -1;            /* no initial video mode     */
  326.    viewwindow = 0;            /* no view window         */
  327.    viewreduction = 4.2;
  328.    viewcrop = 1;
  329.    finalaspectratio = SCREENASPECT;
  330.    viewxdots = viewydots = 0;
  331.    debugflag = 0;            /* debugging flag(s) are off */
  332.    timerflag = 0;            /* timer flags are off         */
  333.    strcpy(FormFileName,"fractint.frm"); /* default formula file      */
  334.    FormName[0] = 0;
  335.    strcpy(LFileName,"fractint.l");
  336.    LName[0] = 0;
  337.    strcpy(CommandFile,"fractint.par");
  338.    CommandName[0] = CommandComment1[0] = CommandComment2[0] = 0;
  339.    strcpy(IFSFileName,"fractint.ifs");
  340.    IFSName[0] = 0;
  341.    reset_ifs_defn();
  342.    rflag = 0;                /* not a fixed srand() seed */
  343.    rseed = init_rseed;
  344.    strcpy(readname,".\\");              /* initially current directory */
  345.    showfile = 1;
  346.    /* next should perhaps be fractal re-init, not just <ins> ? */
  347.    initcyclelimit=55;            /* spin-DAC default speed limit */
  348.    mapset = 0;                /* no map= name active */
  349.    if (mapdacbox) {
  350.       farmemfree(mapdacbox);
  351.       mapdacbox = NULL;
  352.       }
  353.    TPlusFlag = 1;
  354.    MaxColorRes = 8;
  355.    PixelZoom = 0;
  356.    NonInterlaced = 0;
  357.  
  358.    Printer_Type = 2;            /* assume an IBM/EPSON      */
  359.    Printer_Resolution = 60;        /* assume low resolution  */
  360.    Printer_Titleblock = 0;        /* assume no title block  */
  361.    Printer_ColorXlat = 0;        /* assume positive image  */
  362.    Printer_SetScreen = 0;        /* assume default screen  */
  363.    Printer_SFrequency = 0;        /* New screen frequency   */
  364.    Printer_SAngle = 0;            /* New screen angle      */
  365.    Printer_SStyle = 0;            /* New screen style      */
  366.    Print_To_File = 0;            /* No print-to-file      */
  367.    Printer_CRLF = 0;            /* Assume CR+LF       */
  368.    EPSFileType = 0;            /* Assume no save to .EPS */
  369.    LPTNumber = 1;            /* assume LPT1 */
  370.  
  371. }
  372.  
  373. static void initvars_fractal()        /* init vars affecting calculation */
  374. {
  375.    int i;
  376.    usr_periodicitycheck = 1;        /* turn on periodicity      */
  377.    inside = 1;                /* inside color = blue      */
  378.    usr_biomorph = -1;            /* turn off biomorph flag */
  379.    outside = -1;            /* outside color = -1 (not used) */
  380.    maxit = 150;             /* initial maxiter      */
  381.    usr_stdcalcmode = 'g';               /* initial solid-guessing */
  382.    usr_floatflag = 0;            /* turn off the float flag */
  383.    finattract = 0;            /* disable finite attractor logic */
  384.    fractype = 0;            /* initial type Set flag  */
  385.    curfractalspecific = &fractalspecific[0];
  386.    initcorners = initparams = 0;
  387.    bailout = 0;             /* no user-entered bailout */
  388.    useinitorbit = 0;
  389.    for (i = 0; i < 4; i++) param[i] = 0.0;     /* initial parameter values */
  390.    for (i = 0; i < 3; i++) potparam[i]    = 0.0; /* initial potential values */
  391.    for (i = 0; i < 3; i++) inversion[i] = 0.0;    /* initial invert values */
  392.    initorbit[0] = initorbit[1] = 0.0;    /* initial orbit values */
  393.    invert = 0;
  394.    decomp[0] = decomp[1] = 0;
  395.    usr_distest = 0;
  396.    distestwidth = 71;
  397.    forcesymmetry = 999;         /* symmetry not forced */
  398.    xx3rd = xxmin = -2.5; xxmax = 1.5;    /* initial corner values  */
  399.    yy3rd = yymin = -1.5; yymax = 1.5;    /* initial corner values  */
  400.    pot16bit = potflag = 0;
  401.    LogFlag = 0;             /* no logarithmic palette */
  402.    set_trig_array(0,"sin");             /* trigfn defaults */
  403.    set_trig_array(1,"sqr");
  404.    set_trig_array(2,"sinh");
  405.    set_trig_array(3,"cosh");
  406.    if (rangeslen) {
  407.       farmemfree((char far *)ranges);
  408.       rangeslen = 0;
  409.       }
  410.    usemag = 0;                /* use corners, not center-mag */
  411.  
  412.    colorstate = colorpreloaded = 0;
  413.    rotate_lo = 1; rotate_hi = 255;    /* color cycling default range */
  414.  
  415.    display3d = 0;            /* 3D display is off        */
  416.    overlay3d = 0;            /* 3D overlay is off        */
  417.  
  418.    initvars_3d();
  419. }
  420.  
  421. static void initvars_3d()        /* init vars affecting 3d */
  422. {
  423.    SPHERE = FALSE;
  424.    preview = 0;
  425.    showbox = 0;
  426.    xadjust = 0;
  427.    yadjust = 0;
  428.    eyeseparation = 0;
  429.    glassestype = 0;
  430.    previewfactor = 20;
  431.    red_crop_left   = 4;
  432.    red_crop_right  = 0;
  433.    blue_crop_left  = 0;
  434.    blue_crop_right = 4;
  435.    red_bright      = 80;
  436.    blue_bright     = 100;
  437.    transparent[0] = transparent[1] = 0; /* no min/max transparency */
  438.    set_3d_defaults();
  439. }
  440.  
  441. static void reset_ifs_defn()
  442. {
  443.    if (ifs_defn) {
  444.       farmemfree((char far *)ifs_defn);
  445.       ifs_defn = NULL;
  446.       }
  447. }
  448.  
  449.  
  450. static int cmdfile(FILE *handle,int mode)
  451.    /* mode = 0 command line @filename          */
  452.    /*         1 sstools.ini              */
  453.    /*         2 <@> command after startup      */
  454.    /*         3 command line @filename/setname */
  455. {
  456.    /* note that cmdfile could be open as text OR as binary */
  457.    /* binary is used in @ command processing for reasonable speed note/point */
  458.    int i;
  459.    int lineoffset = 0;
  460.    int changeflag = 0; /* &1 fractal stuff chgd, &2 3d stuff chgd */
  461.    char linebuf[513],cmdbuf[1001];
  462.    if (mode == 2 || mode == 3) {
  463.       while ((i = getc(handle)) != '{' && i != EOF) { }
  464.       CommandComment1[0] = CommandComment2[0] = 0;
  465.       }
  466.    linebuf[0] = 0;
  467.    while (next_command(cmdbuf,1000,handle,linebuf,&lineoffset,mode) > 0) {
  468.       if ((mode == 2 || mode == 3) && strcmp(cmdbuf,"}") == 0) break;
  469.       if ((i = cmdarg(cmdbuf,mode)) < 0) break;
  470.       changeflag |= i;
  471.       }
  472.    fclose(handle);
  473.    return changeflag;
  474. }
  475.  
  476. static int next_command(char *cmdbuf,int maxlen,
  477.               FILE *handle,char *linebuf,int *lineoffset,int mode)
  478. {
  479.    int cmdlen = 0;
  480.    char *lineptr;
  481.    lineptr = linebuf + *lineoffset;
  482.    while(1) {
  483.       while (*lineptr <= ' ' || *lineptr == ';') {
  484.      if (cmdlen) {            /* space or ; marks end of command */
  485.         cmdbuf[cmdlen] = 0;
  486.         *lineoffset = lineptr - linebuf;
  487.         return cmdlen;
  488.         }
  489.      while (*lineptr && *lineptr <= ' ')
  490.         ++lineptr;            /* skip spaces and tabs */
  491.      if (*lineptr == ';' || *lineptr == 0) {
  492.         if (*lineptr == ';'
  493.           && (mode == 2 || mode == 3)
  494.           && (CommandComment1[0] == 0 || CommandComment2[0] == 0)) {
  495.            /* save comment */
  496.            while (*(++lineptr)
  497.          && (*lineptr == ' ' || *lineptr == '\t')) { }
  498.            if (*lineptr) {
  499.           if (strlen(lineptr) > 56)
  500.              *(lineptr+56) = 0;
  501.           if (CommandComment1[0] == 0)
  502.              strcpy(CommandComment1,lineptr);
  503.           else
  504.              strcpy(CommandComment2,lineptr);
  505.           }
  506.            }
  507.         if (next_line(handle,linebuf,mode) != 0)
  508.            return(-1); /* eof */
  509.         lineptr = linebuf; /* start new line */
  510.         }
  511.      }
  512.       if (*lineptr == '\\'              /* continuation onto next line? */
  513.     && *(lineptr+1) == 0) {
  514.      if (next_line(handle,linebuf,mode) != 0) {
  515.         argerror(cmdbuf);        /* missing continuation */
  516.         return(-1);
  517.         }
  518.      lineptr = linebuf;
  519.      while (*lineptr && *lineptr <= ' ')
  520.         ++lineptr;            /* skip white space @ start next line */
  521.      continue;            /* loop to check end of line again */
  522.      }
  523.       cmdbuf[cmdlen] = *(lineptr++);    /* copy character to command buffer */
  524.       if (++cmdlen >= maxlen) {     /* command too long? */
  525.      argerror(cmdbuf);
  526.      return(-1);
  527.      }
  528.       }
  529. }
  530.  
  531. static int next_line(FILE *handle,char *linebuf,int mode)
  532. {
  533.    int i,toolssection;
  534.    char tmpbuf[10];
  535.    toolssection = 0;
  536.    while ((i = file_gets(linebuf,512,handle)) >= 0) {
  537.       if (mode == 1 && linebuf[0] == '[') {     /* check for [fractint] */
  538.      strncpy(tmpbuf,&linebuf[1],9);
  539.      tmpbuf[9] = 0;
  540.      strlwr(tmpbuf);
  541.      toolssection = strncmp(tmpbuf,"fractint]",9);
  542.      continue;                /* skip tools section heading */
  543.      }
  544.       if (toolssection == 0) return(0);
  545.       }
  546.    return(-1);
  547. }
  548.  
  549.  
  550. /*
  551.   cmdarg(string,mode) processes a single command-line/command-file argument
  552.     return:
  553.       -1 error, >= 0 ok
  554.       if ok, return value:
  555.     | 1 means fractal parm has been set
  556.     | 2 means 3d parm has been set
  557.     | 4 means 3d=yes specified
  558.     | 8 means reset specified
  559. */
  560.  
  561. static int cmdarg(char *curarg,int mode) /* process a single argument */
  562. {
  563.    char    variable[21];        /* variable name goes here   */
  564.    char    *value;            /* pointer to variable value */
  565.    int       valuelen;            /* length of value         */
  566.    int       numval;            /* numeric value of arg      */
  567. #define NONNUMERIC -32767
  568.    char    charval;            /* first character of arg    */
  569.    int       yesnoval;            /* 0 if 'n', 1 if 'y', -1 if not */
  570.    double  ftemp;
  571.    int       i, j, k, l;
  572.    char    *argptr,*argptr2;
  573.    int       totparms;            /* # of / delimited parms    */
  574.    int       intparms;            /* # of / delimited ints     */
  575.    int       floatparms;            /* # of / delimited floats   */
  576.    int       intval[64];            /* pre-parsed integer parms  */
  577.    double  floatval[16];        /* pre-parsed floating parms */
  578.    char    tmpc;
  579.    int       lastarg;
  580.  
  581.    argptr = curarg;
  582.    while (*argptr) {            /* convert to lower case */
  583.       if (*argptr >= 'A' && *argptr <= 'Z')
  584.      *argptr += 'a' - 'A';
  585.       if (*argptr == '=' && strncmp(curarg,"colors=",7) == 0)
  586.      break;             /* don't convert colors=value */
  587.       ++argptr;
  588.       }
  589.  
  590.    if ((value = strchr(&curarg[1],'='))) {
  591.       if ((j = (value++) - curarg) > 1 && curarg[j-1] == ':')
  592.      --j;                /* treat := same as =      */
  593.       }
  594.    else
  595.       value = curarg + (j = strlen(curarg));
  596.    if (j > 20) goto badarg;        /* keyword too long */
  597.    strncpy(variable,curarg,j);        /* get the variable name  */
  598.    variable[j] = 0;            /* truncate variable name */
  599.    valuelen = strlen(value);        /* note value's length    */
  600.    charval = value[0];            /* first letter of value  */
  601.    yesnoval = -1;            /* note yes|no value      */
  602.    if (charval == 'n') yesnoval = 0;
  603.    if (charval == 'y') yesnoval = 1;
  604.  
  605.    argptr = value;
  606.    numval = totparms = intparms = floatparms = 0;
  607.    while (*argptr) {            /* count and pre-parse parms */
  608.       lastarg = 0;
  609.       if ((argptr2 = strchr(argptr,'/')) == NULL) {     /* find next '/' */
  610.      argptr2 = argptr + strlen(argptr);
  611.      *argptr2 = '/';
  612.      lastarg = 1;
  613.      }
  614.       if (totparms == 0) numval = NONNUMERIC;
  615.       i = -1;
  616.       if (sscanf(argptr,"%d%c",&j,&tmpc) > 0            /* got an integer */
  617.     && tmpc == '/') {
  618.      ++floatparms; ++intparms;
  619.      if (totparms < 16) floatval[totparms] = j;
  620.      if (totparms < 64) intval[totparms] = j;
  621.      if (totparms == 0) numval = j;
  622.      }
  623.       else if (sscanf(argptr,"%lg%c",&ftemp,&tmpc) > 0  /* got a float */
  624.          && tmpc == '/') {
  625.      ++floatparms;
  626.      if (totparms < 16) floatval[totparms] = ftemp;
  627.      }
  628.       ++totparms;
  629.       argptr = argptr2;                 /* on to the next */
  630.       if (lastarg)
  631.      *argptr = 0;
  632.       else
  633.      ++argptr;
  634.       }
  635.  
  636.    if (mode != 2) {    /* these commands are allowed only at startup */
  637.  
  638.       if (strcmp(variable,"batch") == 0 ) {     /* batch=?      */
  639.      if (yesnoval < 0) goto badarg;
  640.      initbatch = yesnoval;
  641.      return 3;
  642.      }
  643.  
  644.       if (strcmp(variable,"adapter") == 0 ) {   /* adapter==?     */
  645.      video_type = 5;            /* assume video=vga */
  646.      if (strcmp(value,"egamono") == 0) {
  647.         video_type = 3;
  648.         mode7text = 1;
  649.         }
  650.      else if (charval == 'h') {             /* video = hgc */
  651.         video_type = 1;
  652.         mode7text = 1;
  653.         }
  654.      else if (charval == 'e')               /* video = ega */
  655.         video_type = 3;
  656.      else if (charval == 'c')               /* video = cga */
  657.         video_type = 2;
  658.      else if (charval == 'm')               /* video = mcga */
  659.         video_type = 4;
  660.      return 3;
  661.      }
  662.  
  663.       if (strcmp(variable,"textsafe") == 0 ) {  /* textsafe==? */
  664.      if (first_init) {
  665.         if (charval == 'n') /* no */
  666.            textsafe = 2;
  667.         else if (charval == 'y') /* yes */
  668.            textsafe = 1;
  669.         else if (charval == 'b') /* bios */
  670.            textsafe = 3;
  671.         else if (charval == 's') /* save */
  672.            textsafe = 4;
  673.         else
  674.            goto badarg;
  675.         }
  676.      return 3;
  677.      }
  678.  
  679.       if (strcmp(variable, "vesadetect") == 0) {
  680.      if (yesnoval < 0) goto badarg;
  681.      vesa_detect = yesnoval;
  682.      return 3;
  683.      }
  684.  
  685.       if (strcmp(variable,"fpu") == 0) {
  686.      if (strcmp(value,"iit") == 0) {
  687.         fpu = 387;
  688.         iit = 1;
  689.         return 0;
  690.         }
  691.      if (strcmp(value,"387") == 0) {
  692.         fpu = 387;
  693.         return 0;
  694.         }
  695.      goto badarg;
  696.      }
  697.  
  698.       if (strcmp(variable,"makedoc") == 0) {
  699.      print_document(*value ? value : "fractint.doc", makedoc_msg_func, 0);
  700.      goodbye();
  701.      }
  702.  
  703.       } /* end of commands allowed only at startup */
  704.  
  705.    if (strcmp(variable,"reset") == 0) {
  706.       initvars_fractal();
  707.       return 9;
  708.       }
  709.  
  710.    if (strcmp(variable,"filename") == 0) {      /* filename=?     */
  711.       if (charval == '.') {
  712.      if (valuelen > 4) goto badarg;
  713.      gifmask[0] = '*';
  714.      gifmask[1] = 0;
  715.      strcat(gifmask,value);
  716.      return 0;
  717.      }
  718.       if (valuelen > 79) goto badarg;
  719.       if (mode == 2 && display3d == 0) /* can't do this in @ command */
  720.      goto badarg;
  721.       strcpy(readname,value);
  722.       showfile = 0;
  723.       return 3;
  724.       }
  725.  
  726.    if (strcmp(variable,"video") == 0) {         /* video=? */
  727.       if (active_system == 0) {
  728.      if ((k = check_vidmode_keyname(value)) == 0) goto badarg;
  729.      initmode = -1;
  730.      for (i = 0; i < MAXVIDEOTABLE; ++i) {
  731.         if (videotable[i].keynum == k) {
  732.            initmode = i;
  733.            break;
  734.            }
  735.         }
  736.      if (initmode == -1) goto badarg;
  737.      }
  738.       return 3;
  739.       }
  740.  
  741.    if (strcmp(variable,"map") == 0 ) {         /* map=, set default colors */
  742.       if (valuelen > 79 || SetColorPaletteName(value) != 0) goto badarg;
  743.       mapset = 1;
  744.       strcpy(MAP_name,value);
  745.       return 0;
  746.       }
  747.  
  748.    if (strcmp(variable,"colors") == 0) {       /* colors=, set current colors */
  749.       if (parse_colors(value) < 0) goto badarg;
  750.       return 0;
  751.       }
  752.  
  753.    if (strcmp(variable, "tplus") == 0) {       /* Use the TARGA+ if found? */
  754.       if (yesnoval < 0) goto badarg;
  755.       TPlusFlag = yesnoval;
  756.       return 0;
  757.       }
  758.  
  759.    if (strcmp(variable, "noninterlaced") == 0) {
  760.       if (yesnoval < 0) goto badarg;
  761.       NonInterlaced = yesnoval;
  762.       return 0;
  763.       }
  764.  
  765.    if (strcmp(variable, "maxcolorres") == 0) { /* Change default color resolution */
  766.       if (numval == 1 || numval == 4 || numval == 8 ||
  767.             numval == 16 || numval == 24) {
  768.      MaxColorRes = numval;
  769.      return 0;
  770.      }
  771.       goto badarg;
  772.       }
  773.  
  774.    if (strcmp(variable, "pixelzoom") == 0) {
  775.       if (numval < 5)
  776.      PixelZoom = numval;
  777.       return 0;
  778.       }
  779.  
  780.    /* keep this for backward compatibility */
  781.    if (strcmp(variable,"warn") == 0 ) {         /* warn=? */
  782.       if (yesnoval < 0) goto badarg;
  783.       overwrite = yesnoval ^ 1;
  784.       return 0;
  785.       }
  786.    if (strcmp(variable,"overwrite") == 0 ) {    /* overwrite=? */
  787.       if (yesnoval < 0) goto badarg;
  788.       overwrite = yesnoval;
  789.       return 0;
  790.       }
  791.  
  792.    if (strcmp(variable,"gif87a") == 0 ) {       /* gif87a=? */
  793.       if (yesnoval < 0) goto badarg;
  794.       gif87a_flag = yesnoval;
  795.       return 0;
  796.       }
  797.  
  798.    if (strcmp(variable,"savetime") == 0) {      /* savetime=? */
  799.       initsavetime = numval;
  800.       return 0;
  801.       }
  802.  
  803.    if (strcmp(variable,"autokey") == 0) {       /* autokey=? */
  804.       if (strcmp(value,"record")==0)
  805.      slides=2;
  806.       else if (strcmp(value,"play")==0)
  807.      slides=1;
  808.       else
  809.      goto badarg;
  810.       return 0;
  811.       }
  812.  
  813.    if (strcmp(variable,"autokeyname") == 0) {   /* autokeyname=? */
  814.       strcpy(autoname,value);
  815.       return 0;
  816.       }
  817.  
  818.    if (strcmp(variable,"type") == 0 ) {         /* type=? */
  819.       if (value[valuelen-1] == '*')
  820.      value[--valuelen] = 0;
  821.       for (k = 0; fractalspecific[k].name != NULL; k++)
  822.      if (strcmp(value,fractalspecific[k].name) == 0)
  823.         break;
  824.       if (fractalspecific[k].name == NULL) goto badarg;
  825.       curfractalspecific = &fractalspecific[fractype = k];
  826.       if (initcorners == 0) {
  827.      xx3rd = xxmin = curfractalspecific->xmin;
  828.      xxmax           = curfractalspecific->xmax;
  829.      yy3rd = yymin = curfractalspecific->ymin;
  830.      yymax           = curfractalspecific->ymax;
  831.      }
  832.       if (initparams == 0)
  833.      for (k = 0; k < 4; ++k) {
  834.         param[k] = curfractalspecific->paramvalue[k];
  835.         roundfloatd(¶m[k]);
  836.         }
  837.       return 1;
  838.       }
  839.  
  840.    if (strcmp(variable,"inside") == 0 ) {       /* inside=? */
  841.       if(strcmp(value,"bof60")==0)
  842.      inside = -60;
  843.       else if(strcmp(value,"bof61")==0)
  844.      inside = -61;
  845.       else if(strcmp(value,"maxiter")==0)
  846.      inside = -1;
  847.       else if(numval == NONNUMERIC)
  848.      goto badarg;
  849.       else
  850.      inside = numval;
  851.       return 1;
  852.       }
  853.  
  854.    if (strcmp(variable,"finattract") == 0 ) {   /* finattract=? */
  855.       if (yesnoval < 0) goto badarg;
  856.       finattract = yesnoval;
  857.       return 1;
  858.       }
  859.  
  860.    if (strcmp(variable,"function") == 0) {      /* function=?,? */
  861.       k = 0;
  862.       while (*value && k < 4) {
  863.      if(set_trig_array(k++,value)) goto badarg;
  864.      if ((value = strchr(value,'/')) == NULL) break;
  865.      ++value;
  866.      }
  867.       return 1;
  868.       }
  869.  
  870.    if (strcmp(variable,"outside") == 0 ) {      /* outside=? */
  871.       if(numval < -1 || numval > 255) goto badarg;
  872.       outside = numval;
  873.       return 1;
  874.       }
  875.  
  876.    if (strcmp(variable,"maxiter") == 0) {       /* maxiter=? */
  877.       if (numval < 2 || numval > 32767) goto badarg;
  878.       maxit = numval;
  879.       return 1;
  880.       }
  881.  
  882.    if (strcmp(variable,"iterincr") == 0)        /* iterincr=? */
  883.       return 0;
  884.  
  885.    if (strcmp(variable,"passes") == 0) {        /* passes=? */
  886.       if ( charval != '1' && charval != '2'
  887.     && charval != 'g' && charval != 'b')
  888.      goto badarg;
  889.       usr_stdcalcmode = charval;
  890.       return 1;
  891.       }
  892.  
  893.    if (strcmp(variable,"cyclelimit") == 0 ) {   /* cyclelimit=? */
  894.       if (numval <= 1 || numval > 256) goto badarg;
  895.       initcyclelimit = numval;
  896.       return 0;
  897.       }
  898.  
  899.    if (strcmp(variable,"cyclerange") == 0) {
  900.       if (totparms < 2) intval[1] = 255;
  901.       if (totparms < 1) intval[0] = 1;
  902.       if (totparms != intparms
  903.     || intval[0] < 0 || intval[1] > 255 || intval[0] > intval[1])
  904.      goto badarg;
  905.       rotate_lo = intval[0];
  906.       rotate_hi = intval[1];
  907.       return 0;
  908.       }
  909.  
  910.    if (strcmp(variable,"ranges") == 0) {
  911.       int i,j,entries,prev;
  912.       int tmpranges[128];
  913.       if (totparms != intparms) goto badarg;
  914.       entries = prev = i = 0;
  915.       while (i < totparms) {
  916.      if ((j = intval[i++]) < 0) { /* striping */
  917.         if ((j = 0-j) < 1 || j >= 16384 || i >= totparms) goto badarg;
  918.         tmpranges[entries++] = -1; /* {-1,width,limit} for striping */
  919.         tmpranges[entries++] = j;
  920.         j = intval[i++];
  921.         }
  922.      if (j < prev) goto badarg;
  923.      tmpranges[entries++] = prev = j;
  924.      }
  925.       if (prev == 0) goto badarg;
  926.       if ((ranges = (int far *)farmemalloc(2L*entries)) == NULL) {
  927.      static char far msg[] = {"Insufficient memory for ranges="};
  928.      stopmsg(0,msg);
  929.      return(-1);
  930.      }
  931.       rangeslen = entries;
  932.       for (i = 0; i < rangeslen; ++i)
  933.      ranges[i] = tmpranges[i];
  934.       return 1;
  935.       }
  936.  
  937.    if (strcmp(variable,"savename") == 0) {      /* savename=? */
  938.       if (valuelen > 79) goto badarg;
  939.       if (first_init || mode == 2)
  940.      strcpy(savename,value);
  941.       return 0;
  942.       }
  943.  
  944.    if (strcmp(variable,"exitmode") == 0) {      /* exitmode=? */
  945.       sscanf(value,"%x",&numval);
  946.       exitmode = numval;
  947.       return 0;
  948.       }
  949.  
  950.    if (strcmp(variable,"textcolors") == 0) {
  951.       parse_textcolors(value);
  952.       return 0;
  953.       }
  954.  
  955.    if (strcmp(variable,"potential") == 0) {     /* potential=? */
  956.       k = 0;
  957.       while (k < 3 && *value) {
  958.      potparam[k++] = atoi(value);
  959.      if ((value = strchr(value,'/')) == NULL) k = 99;
  960.      ++value;
  961.      }
  962.       pot16bit = 0;
  963.       if (k < 99) {
  964.      if (strcmp(value,"16bit")) goto badarg;
  965.      pot16bit = 1;
  966.      }
  967.       return 1;
  968.       }
  969.  
  970.    if (strcmp(variable,"params") == 0) {        /* params=?,? */
  971.       if (totparms != floatparms || totparms > 4)
  972.      goto badarg;
  973.       for (k = 0; k < 4; ++k)
  974.      param[k] = (k < totparms) ? floatval[k] : 0.0;
  975.       initparams = 1;
  976.       return 1;
  977.       }
  978.  
  979.    if (strcmp(variable,"initorbit") == 0) {     /* initorbit=?,? */
  980.       if(strcmp(value,"pixel")==0)
  981.      useinitorbit = 2;
  982.       else {
  983.      if (totparms != 2 || floatparms != 2) goto badarg;
  984.      initorbit[0] = floatval[0];
  985.      initorbit[1] = floatval[1];
  986.      useinitorbit = 1;
  987.      }
  988.       return 1;
  989.       }
  990.  
  991.    if (strcmp(variable,"corners") == 0) {       /* corners=?,?,?,? */
  992.       if (floatparms != totparms || (totparms != 4 && totparms != 6))
  993.      goto badarg;
  994.       usemag = 0;
  995.       initcorners = 1;
  996.       xx3rd = xxmin = floatval[0];
  997.       xxmax =          floatval[1];
  998.       yy3rd = yymin = floatval[2];
  999.       yymax =          floatval[3];
  1000.       if (totparms == 6) {
  1001.      xx3rd =      floatval[4];
  1002.      yy3rd =      floatval[5];
  1003.      }
  1004.       return 1;
  1005.       }
  1006.  
  1007.    if (strcmp(variable,"center-mag") == 0) {    /* center-mag=?,?,? */
  1008.       double Xctr, Yctr,Magnification,Ratio,Height, Width,Radius;
  1009.       if (totparms != floatparms
  1010.     || (totparms != 0 && totparms != 3)
  1011.     || (totparms == 3 && floatval[2] <= 0.0))
  1012.      goto badarg;
  1013.       usemag = 1;
  1014.       if (totparms == 0) return 0;
  1015.       initcorners = 1;
  1016.       Xctr = floatval[0];
  1017.       Yctr = floatval[1];
  1018.       Magnification = floatval[2];
  1019.       Radius = 1.0 / Magnification;
  1020.       Ratio = .75;    /* inverse aspect ratio of screen  */
  1021.       /* calculate bounds */
  1022.       Height = 2.0 * Radius;
  1023.       Width = Height / Ratio;
  1024.       yymax = Yctr + Radius;
  1025.       yy3rd = yymin = Yctr - Radius;
  1026.       xxmax = Xctr + Width / 2.0;
  1027.       xx3rd = xxmin = Xctr - Width / 2.0;
  1028.       return 1;
  1029.       }
  1030.  
  1031.    if (strcmp(variable,"invert") == 0) {        /* invert=?,?,? */
  1032.       if (totparms != floatparms || (totparms != 1 && totparms != 3))
  1033.      goto badarg;
  1034.       invert = ((inversion[0] = floatval[0]) != 0.0) ? totparms : 0;
  1035.       if (totparms == 3) {
  1036.      inversion[1] = floatval[1];
  1037.      inversion[2] = floatval[2];
  1038.      }
  1039.       return 1;
  1040.       }
  1041.  
  1042.    if (strcmp(variable,"askvideo") == 0 ) {     /* askvideo=?   */
  1043.       if (yesnoval < 0) goto badarg;
  1044.       askvideo = yesnoval;
  1045.       return 0;
  1046.       }
  1047.  
  1048.    if (strcmp(variable,"ramvideo") == 0 )       /* ramvideo=?   */
  1049.       return 0; /* just ignore and return, for old time's sake */
  1050.  
  1051.    if (strcmp(variable,"float") == 0 ) {        /* float=? */
  1052.       if (yesnoval < 0) goto badarg;
  1053.       usr_floatflag = yesnoval;
  1054.       return 3;
  1055.       }
  1056.  
  1057.    if (strcmp(variable,"biomorph") == 0 ) {     /* biomorph=? */
  1058.       usr_biomorph = numval;
  1059.       return 1;
  1060.       }
  1061.  
  1062.    if (strcmp(variable,"orbitsave") == 0 ) {     /* orbitsave=? */
  1063.       if (yesnoval < 0) goto badarg;
  1064.       orbitsave = yesnoval;
  1065.       return 1;
  1066.       }
  1067.  
  1068.    if (strcmp(variable,"bailout") == 0 ) {      /* bailout=? */
  1069.       if (numval < 4 || numval > 32000) goto badarg;
  1070.       bailout = numval;
  1071.       return 1;
  1072.       }
  1073.  
  1074.    if (strcmp(variable,"symmetry") == 0 ) {     /* symmetry=? */
  1075.       if     (strcmp(value,"xaxis" )==0) forcesymmetry = XAXIS;
  1076.       else if(strcmp(value,"yaxis" )==0) forcesymmetry = YAXIS;
  1077.       else if(strcmp(value,"xyaxis")==0) forcesymmetry = XYAXIS;
  1078.       else if(strcmp(value,"origin")==0) forcesymmetry = ORIGIN;
  1079.       else if(strcmp(value,"pi"    )==0) forcesymmetry = PI_SYM;
  1080.       else if(strcmp(value,"none"  )==0) forcesymmetry = NOSYM;
  1081.       else goto badarg;
  1082.       return 1;
  1083.       }
  1084.  
  1085.    if (strcmp(variable,"printer") == 0 ) {      /* printer=? */
  1086.       if (parse_printer(value) < 0) goto badarg;
  1087.       return 0;
  1088.       }
  1089.  
  1090.    if (strcmp(variable,"printfile") == 0) {     /* print-to-file? SWT */
  1091.       if (valuelen > 79) goto badarg;
  1092.       Print_To_File = 1;
  1093.       strcpy(PrintName,value);
  1094.       return 0;
  1095.       }
  1096.  
  1097.    if (strcmp(variable,"epsf") == 0) {          /* EPS type? SWT */
  1098.       Print_To_File = 1;
  1099.       EPSFileType = numval;
  1100.       Printer_Type = 5;
  1101.       if (strcmp(PrintName,"fract001.prn")==0)
  1102.      strcpy(PrintName,"fract001.eps");
  1103.       return 0;
  1104.       }
  1105.  
  1106.    if (strcmp(variable,"title") == 0) {         /* Printer title block? SWT */
  1107.       if (yesnoval < 0) goto badarg;
  1108.       Printer_Titleblock = yesnoval;
  1109.       return 0;
  1110.       }
  1111.  
  1112.    if (strcmp(variable,"translate") == 0) {     /* Translate color? SWT */
  1113.       Printer_ColorXlat=0;
  1114.       if (charval == 'y')
  1115.      Printer_ColorXlat=1;
  1116.       else if (numval > 1 || numval < -1)
  1117.      Printer_ColorXlat=numval;
  1118.       return 0;
  1119.       }
  1120.  
  1121.    if (strcmp(variable,"plotstyle") == 0) {     /* plot style? SWT */
  1122.       Printer_SStyle = numval;
  1123.       return 0;
  1124.       }
  1125.  
  1126.    if (strcmp(variable,"halftone") == 0) {      /* New halftoning? SWT */
  1127.       if (totparms != intparms) goto badarg;
  1128.       Printer_SetScreen=1;
  1129.       Printer_SFrequency=80;
  1130.       Printer_SAngle=45;
  1131.       Printer_SStyle=0;
  1132.       if (totparms > 0) Printer_SFrequency = intval[0];
  1133.       if (totparms > 1) Printer_SAngle       = intval[1];
  1134.       if (totparms > 2) Printer_SStyle       = intval[2];
  1135.       return 0;
  1136.       }
  1137.  
  1138.    if (strcmp(variable,"linefeed") == 0) {      /* Use LF for printer */
  1139.       if      (strcmp(value,"cr")   == 0) Printer_CRLF = 1;
  1140.       else if (strcmp(value,"lf")   == 0) Printer_CRLF = 2;
  1141.       else if (strcmp(value,"crlf") == 0) Printer_CRLF = 0;
  1142.       else goto badarg;
  1143.       return 0;
  1144.       }
  1145.  
  1146.    if (strcmp(variable,"comport") == 0 ) {      /* Set the COM parameters */
  1147.       if ((value=strchr(value,'/')) == NULL) goto badarg;
  1148.       switch (atoi(++value)) {
  1149.      case 110:  l = 0;   break;
  1150.      case 150:  l = 32;  break;
  1151.      case 300:  l = 64;  break;
  1152.      case 600:  l = 96;  break;
  1153.      case 1200: l = 128; break;
  1154.      case 2400: l = 160; break;
  1155.      case 4800: l = 192; break;
  1156.      case 9600:
  1157.      default:   l = 224; break;
  1158.      }
  1159.       if ((value=strchr(value,'/')) == NULL) goto badarg;
  1160.       for (k=0; k < strlen(value); k++) {
  1161.      switch (value[k]) {
  1162.         case '7':  l |= 2;  break;
  1163.         case '8':  l |= 3;  break;
  1164.         case 'o':  l |= 8;  break;
  1165.         case 'e':  l |= 24; break;
  1166.         case '2':  l |= 4;  break;
  1167.         }
  1168.      }
  1169. #ifndef WINFRACT
  1170.       _bios_serialcom(0,numval-1,l);
  1171. #endif
  1172.       return 0;
  1173.       }
  1174.  
  1175.    if (strcmp(variable,"sound") == 0 ) {        /* sound=? */
  1176.       soundflag = 0;
  1177.       if (strncmp(value,"ye",2) == 0)
  1178.      soundflag = -1;
  1179.       if (charval == 'x')
  1180.      soundflag = 1;
  1181.       if (charval == 'y')
  1182.      soundflag = 2;
  1183.       if (charval == 'z')
  1184.      soundflag = 3;
  1185.       return 0;
  1186.       }
  1187.  
  1188.    if (strcmp(variable,"hertz") == 0) {         /* Hertz=? */
  1189.       if (numval < 200 || numval > 10000) goto badarg;
  1190.       basehertz = numval;
  1191.       return 0;
  1192.       }
  1193.  
  1194.    if (strcmp(variable,"periodicity") == 0 ) {  /* periodicity=? */
  1195.       usr_periodicitycheck=1;
  1196.       if (charval == 'n')
  1197.      usr_periodicitycheck=0;
  1198.       else if (charval == 'y')
  1199.      usr_periodicitycheck=1;
  1200.       else if (charval == 's')   /* 's' for 'show' */
  1201.      usr_periodicitycheck=-1;
  1202.       else if(numval == NONNUMERIC)
  1203.      goto badarg;
  1204.       else if(numval != 0)
  1205.      usr_periodicitycheck=numval;
  1206.       return 1;
  1207.       }
  1208.  
  1209.    if (strcmp(variable,"logmap") == 0 ) {       /* logmap=? */
  1210.       if (charval == 'y')
  1211.      LogFlag = 1;                /* palette is logarithmic */
  1212.       else if (charval == 'n')
  1213.      LogFlag = 0;
  1214.       else if (charval == 'o')
  1215.      LogFlag = -1;                /* old log palette */
  1216.       else
  1217.      LogFlag = numval;
  1218.       return 1;
  1219.       }
  1220.  
  1221.    if (strcmp(variable,"debugflag") == 0
  1222.      || strcmp(variable,"debug") == 0) {        /* internal use only */
  1223.       debugflag = numval;
  1224.       timerflag = debugflag & 1;        /* separate timer flag */
  1225.       debugflag -= timerflag;
  1226.       return 0;
  1227.       }
  1228.  
  1229.    if (strcmp(variable, "rseed") == 0) {
  1230.       rseed = numval;
  1231.       rflag = 1;
  1232.       return 1;
  1233.       }
  1234.  
  1235.    if (strcmp(variable, "decomp") == 0) {
  1236.       if (totparms != intparms || totparms < 1) goto badarg;
  1237.       decomp[0] = intval[0];
  1238.       decomp[1] = 0;
  1239.       if (totparms > 1) /* backward compatibility */
  1240.      bailout = decomp[1] = intval[1];
  1241.       return 1;
  1242.       }
  1243.  
  1244.    if (strcmp(variable, "distest") == 0) {
  1245.       if (totparms != intparms || totparms < 1) goto badarg;
  1246.       usr_distest = intval[0];
  1247.       distestwidth = 71;
  1248.       if (totparms > 1)
  1249.      distestwidth = intval[1];
  1250.       return 1;
  1251.       }
  1252.  
  1253.    if (strcmp(variable,"formulafile") == 0) {   /* formulafile=? */
  1254.       if (valuelen > 79) goto badarg;
  1255.       strcpy(FormFileName,value);
  1256.       return 1;
  1257.       }
  1258.  
  1259.    if (strcmp(variable,"formulaname") == 0) {   /* formulaname=? */
  1260.       if (valuelen > ITEMNAMELEN) goto badarg;
  1261.       strcpy(FormName,value);
  1262.       return 1;
  1263.       }
  1264.  
  1265.    if (strcmp(variable,"lfile") == 0) {
  1266.       if (valuelen > 79) goto badarg;
  1267.       strcpy(LFileName,value);
  1268.       return 1;
  1269.       }
  1270.  
  1271.    if (strcmp(variable,"lname") == 0) {
  1272.       if (valuelen > ITEMNAMELEN) goto badarg;
  1273.       strcpy(LName,value);
  1274.       return 1;
  1275.       }
  1276.  
  1277.    if (strcmp(variable,"ifsfile") == 0) {
  1278.       if (valuelen > 79) goto badarg;
  1279.       strcpy(IFSFileName,value);
  1280.       reset_ifs_defn();
  1281.       return 1;
  1282.       }
  1283.  
  1284.    if (strcmp(variable,"ifs") == 0
  1285.      || strcmp(variable,"ifs3d") == 0) {        /* ifs3d for old time's sake */
  1286.       if (valuelen > ITEMNAMELEN) goto badarg;
  1287.       strcpy(IFSName,value);
  1288.       reset_ifs_defn();
  1289.       return 1;
  1290.       }
  1291.  
  1292.    if (strcmp(variable,"parmfile") == 0) {
  1293.       if (valuelen > 79) goto badarg;
  1294.       strcpy(CommandFile,value);
  1295.       return 0;
  1296.       }
  1297.  
  1298.    if (strcmp(variable,"stereo") == 0) {        /* stereo=? */
  1299.       if ((numval<0) || (numval>3)) goto badarg;
  1300.       glassestype = numval;
  1301.       return 3;
  1302.       }
  1303.  
  1304.    if (strcmp(variable,"rotation") == 0) {      /* rotation=?/?/? */
  1305.       if (totparms != 3 || intparms != 3) goto badarg;
  1306.       XROT = intval[0];
  1307.       YROT = intval[1];
  1308.       ZROT = intval[2];
  1309.       return 3;
  1310.       }
  1311.  
  1312.    if (strcmp(variable,"perspective") == 0) {   /* perspective=? */
  1313.       if (numval == NONNUMERIC) goto badarg;
  1314.       ZVIEWER = numval;
  1315.       return 3;
  1316.       }
  1317.  
  1318.    if (strcmp(variable,"xyshift") == 0) {       /* xyshift=?/?  */
  1319.       if (totparms != 2 || intparms != 2) goto badarg;
  1320.       XSHIFT = intval[0];
  1321.       YSHIFT = intval[1];
  1322.       return 3;
  1323.       }
  1324.  
  1325.    if (strcmp(variable,"interocular") == 0) {   /* interocular=? */
  1326.       eyeseparation = numval;
  1327.       return 3;
  1328.       }
  1329.  
  1330.    if (strcmp(variable,"converge") == 0) {      /* converg=? */
  1331.       xadjust = numval;
  1332.       return 3;
  1333.       }
  1334.  
  1335.    if (strcmp(variable,"crop") == 0) {          /* crop=? */
  1336.       if (totparms != 4 || intparms != 4
  1337.     || intval[0] < 0 || intval[0] > 100
  1338.     || intval[1] < 0 || intval[1] > 100
  1339.     || intval[2] < 0 || intval[2] > 100
  1340.     || intval[3] < 0 || intval[3] > 100)
  1341.       goto badarg;
  1342.       red_crop_left   = intval[0];
  1343.       red_crop_right  = intval[1];
  1344.       blue_crop_left  = intval[2];
  1345.       blue_crop_right = intval[3];
  1346.       return 3;
  1347.       }
  1348.  
  1349.    if (strcmp(variable,"bright") == 0) {        /* bright=? */
  1350.       if (totparms != 2 || intparms != 2) goto badarg;
  1351.       red_bright  = intval[0];
  1352.       blue_bright = intval[1];
  1353.       return 3;
  1354.       }
  1355.  
  1356.    if (strcmp(variable,"xyadjust") == 0) {      /* trans=? */
  1357.       if (totparms != 2 || intparms != 2) goto badarg;
  1358.       xtrans = intval[0];
  1359.       ytrans = intval[1];
  1360.       return 3;
  1361.       }
  1362.  
  1363.    if (strcmp(variable,"3d") == 0) {            /* 3d=?/?/..    */
  1364.       if (yesnoval < 0) goto badarg;
  1365.       display3d = yesnoval;
  1366.       initvars_3d();
  1367.       return (display3d) ? 6 : 2;
  1368.       }
  1369.  
  1370.    if (strcmp(variable,"sphere") == 0 ) {       /* sphere=? */
  1371.       if (yesnoval < 0) goto badarg;
  1372.       SPHERE = yesnoval;
  1373.       return 2;
  1374.       }
  1375.  
  1376.    if (strcmp(variable,"scalexyz") == 0) {      /* scalexyz=?/?/? */
  1377.       if (totparms < 2 || intparms != totparms) goto badarg;
  1378.       XSCALE = intval[0];
  1379.       YSCALE = intval[1];
  1380.       if (totparms > 2) ROUGH = intval[2];
  1381.       return 2;
  1382.       }
  1383.  
  1384.    /* "rough" is really scale z, but we add it here for convenience */
  1385.    if (strcmp(variable,"roughness") == 0) {     /* roughness=?  */
  1386.       ROUGH = numval;
  1387.       return 2;
  1388.       }
  1389.  
  1390.    if (strcmp(variable,"waterline") == 0) {     /* waterline=?  */
  1391.       if (numval<0) goto badarg;
  1392.       WATERLINE = numval;
  1393.       return 2;
  1394.       }
  1395.  
  1396.    if (strcmp(variable,"filltype") == 0) {      /* filltype=?   */
  1397.       if (numval < -1 || numval > 6) goto badarg;
  1398.       FILLTYPE = numval;
  1399.       return 2;
  1400.       }
  1401.  
  1402.    if (strcmp(variable,"lightsource") == 0) {   /* lightsource=?/?/? */
  1403.       if (totparms != 3 || intparms != 3) goto badarg;
  1404.       XLIGHT = intval[0];
  1405.       YLIGHT = intval[1];
  1406.       ZLIGHT = intval[2];
  1407.       return 2;
  1408.       }
  1409.  
  1410.    if (strcmp(variable,"smoothing") == 0) {     /* smoothing=?  */
  1411.       if (numval<0) goto badarg;
  1412.       LIGHTAVG = numval;
  1413.       return 2;
  1414.       }
  1415.  
  1416.    if (strcmp(variable,"latitude") == 0) {      /* latitude=?/? */
  1417.       if (totparms != 2 || intparms != 2) goto badarg;
  1418.       THETA1 = intval[0];
  1419.       THETA2 = intval[1];
  1420.       return 2;
  1421.       }
  1422.  
  1423.    if (strcmp(variable,"longitude") == 0) {     /* longitude=?/? */
  1424.       if (totparms != 2 || intparms != 2) goto badarg;
  1425.       PHI1 = intval[0];
  1426.       PHI2 = intval[1];
  1427.       return 2;
  1428.       }
  1429.  
  1430.    if (strcmp(variable,"radius") == 0) {        /* radius=? */
  1431.       if (numval < 0) goto badarg;
  1432.       RADIUS = numval;
  1433.       return 2;
  1434.       }
  1435.  
  1436.    if (strcmp(variable,"transparent") == 0) {   /* transparent? */
  1437.       if (totparms != intparms || totparms < 1) goto badarg;
  1438.       transparent[1] = transparent[0] = intval[0];
  1439.       if (totparms > 1) transparent[1] = intval[1];
  1440.       return 2;
  1441.       }
  1442.  
  1443.    if (strcmp(variable,"preview") == 0) {       /* preview? */
  1444.       if (yesnoval < 0) goto badarg;
  1445.       preview = yesnoval;
  1446.       return 2;
  1447.       }
  1448.  
  1449.    if (strcmp(variable,"showbox") == 0) {       /* showbox? */
  1450.       if (yesnoval < 0) goto badarg;
  1451.       showbox = yesnoval;
  1452.       return 2;
  1453.       }
  1454.  
  1455.    if (strcmp(variable,"coarse") == 0) {        /* coarse=? */
  1456.       if (numval < 3 || numval > 2000) goto badarg;
  1457.       previewfactor = numval;
  1458.       return 2;
  1459.       }
  1460.  
  1461.    if (strcmp(variable,"randomize") == 0) {     /* RANDOMIZE=? */
  1462.       if (numval<0 || numval>7) goto badarg;
  1463.       RANDOMIZE = numval;
  1464.       return 2;
  1465.       }
  1466.  
  1467.    if (strcmp(variable,"ambient") == 0) {       /* ambient=? */
  1468.       if (numval<0||numval>100) goto badarg;
  1469.       Ambient = numval;
  1470.       return 2;
  1471.       }
  1472.  
  1473.    if (strcmp(variable,"haze") == 0) {          /* haze=? */
  1474.       if (numval<0||numval>100) goto badarg;
  1475.       haze = numval;
  1476.       return 2;
  1477.       }
  1478.  
  1479.    if (strcmp(variable,"fullcolor") == 0) {     /* fullcolor=? */
  1480.       if (yesnoval < 0) goto badarg;
  1481.       full_color = yesnoval;
  1482.       return 2;
  1483.       }
  1484.  
  1485.    if (strcmp(variable,"lightname") == 0) {     /* lightname=?   */
  1486.       if (valuelen > 79) goto badarg;
  1487.       if (first_init || mode == 2)
  1488.      strcpy(light_name,value);
  1489.       return 0;
  1490.       }
  1491.  
  1492.    if (strcmp(variable,"ray") == 0) {           /* RAY=? */
  1493.       if (numval < 0 || numval > 6) goto badarg;
  1494.       RAY = numval;
  1495.       return 2;
  1496.       }
  1497.  
  1498.    if (strcmp(variable,"brief") == 0) {         /* BRIEF? */
  1499.       if (yesnoval < 0) goto badarg;
  1500.       BRIEF = yesnoval;
  1501.       return 2;
  1502.       }
  1503.  
  1504.  
  1505. badarg:
  1506.    argerror(curarg);
  1507.    return(-1);
  1508.  
  1509. }
  1510.  
  1511. /* Some routines broken out of above so compiler doesn't run out of heap: */
  1512.  
  1513. static void parse_textcolors(char *value)
  1514. {
  1515.    int i,j,k,hexval;
  1516.    if (strcmp(value,"mono") == 0) {
  1517.       for (k = 0; k < sizeof(txtcolor); ++k)
  1518.      txtcolor[k] = BLACK*16+WHITE;
  1519.    /* C_HELP_CURLINK = C_PROMPT_INPUT = C_CHOICE_CURRENT = C_GENERAL_INPUT
  1520.              = C_AUTHDIV1 = C_AUTHDIV2 = WHITE*16+BLACK; */
  1521.       txtcolor[6] = txtcolor[12] = txtcolor[13] = txtcolor[14] = txtcolor[20]
  1522.           = txtcolor[27] = txtcolor[28] = WHITE*16+BLACK;
  1523.       /* C_TITLE = C_HELP_HDG = C_HELP_LINK = C_PROMPT_HI = C_CHOICE_SP_KEYIN
  1524.          = C_GENERAL_HI = C_DVID_HI = C_STOP_ERR
  1525.          = C_STOP_INFO = BLACK*16+L_WHITE; */
  1526.       txtcolor[0] = txtcolor[2] = txtcolor[5] = txtcolor[11] = txtcolor[16]
  1527.           = txtcolor[17] = txtcolor[22] = txtcolor[24]
  1528.           = txtcolor[25] = BLACK*16+L_WHITE;
  1529.       }
  1530.    else {
  1531.       k = 0;
  1532.       while ( k < sizeof(txtcolor)) {
  1533.      if (*value == 0) break;
  1534.      if (*value != '/') {
  1535.         sscanf(value,"%x",&hexval);
  1536.         i = (hexval / 16) & 7;
  1537.         j = hexval & 15;
  1538.         if (i == j || (i == 0 && j == 8)) /* force contrast */
  1539.            j = 15;
  1540.         txtcolor[k] = i * 16 + j;
  1541.         if ((value = strchr(value,'/')) == NULL) break;
  1542.         }
  1543.      ++value;
  1544.      ++k;
  1545.      }
  1546.       }
  1547. }
  1548.  
  1549. static int parse_colors(char *value)
  1550. {
  1551.    int i,j,k;
  1552.    if (*value == '@') {
  1553.       if (strlen(value) > 80 || ValidateLuts(&value[1]) != 0) goto badcolor;
  1554.       strcpy(colorfile,&value[1]);
  1555.       colorstate = 2;
  1556.       }
  1557.    else {
  1558.       int smooth;
  1559.       i = smooth = 0;
  1560.       while (*value) {
  1561.      if (i >= 256) goto badcolor;
  1562.      if (*value == '<') {
  1563.         if (i == 0 || smooth
  1564.           || (smooth = atoi(value+1)) < 2
  1565.           || (value = strchr(value,'>')) == NULL)
  1566.            goto badcolor;
  1567.         i += smooth;
  1568.         ++value;
  1569.         }
  1570.      else {
  1571.         for (j = 0; j < 3; ++j) {
  1572.            if ((k = *(value++)) < '0')  goto badcolor;
  1573.            else if (k <= '9')       k -= '0';
  1574.            else if (k < 'A')            goto badcolor;
  1575.            else if (k <= 'Z')       k -= ('A'-10);
  1576.            else if (k < '_' || k > 'z') goto badcolor;
  1577.            else            k -= ('_'-36);
  1578.            dacbox[i][j] = k;
  1579.            if (smooth) {
  1580.           double step;
  1581.           int diff,start,spread,cnum,dir;
  1582.           start = i - (spread = smooth + 1);
  1583.           cnum = 0;
  1584.           if ((diff = k - (int)dacbox[start][j]) == 0) {
  1585.              while (++cnum < spread)
  1586.             dacbox[start+cnum][j] = k;
  1587.              }
  1588.           else {
  1589.              while (++cnum < spread)
  1590.             dacbox[start+cnum][j] =
  1591.                ( cnum         *dacbox[i][j]
  1592.                + (i-(start+cnum))*dacbox[start][j]
  1593.                + spread/2 )
  1594.                / spread;
  1595.              }
  1596.           }
  1597.            }
  1598.         smooth = 0;
  1599.         ++i;
  1600.         }
  1601.      }
  1602.       if (smooth) goto badcolor;
  1603.       while (i < 256)  { /* zap unset entries */
  1604.      dacbox[i][0] = dacbox[i][1] = dacbox[i][2] = 40;
  1605.      ++i;
  1606.      }
  1607.       colorstate = 1;
  1608.       }
  1609.    colorpreloaded = 1;
  1610.    return(0);
  1611. badcolor:
  1612.    return(-1);
  1613. }
  1614.  
  1615. static int parse_printer(char *value)
  1616. {
  1617.    int k;
  1618.    if (value[0]=='h' && value[1]=='p')
  1619.       Printer_Type=1;                 /* HP LaserJet           */
  1620.    if (value[0]=='i' && value[1]=='b')
  1621.       Printer_Type=2;                 /* IBM Graphics           */
  1622.    if (value[0]=='e' && value[1]=='p')
  1623.       Printer_Type=2;                 /* Epson (model?)           */
  1624.    if (value[0]=='c' && value[1]=='o')
  1625.       Printer_Type=3;                 /* Star (Epson-Comp?) color */
  1626.    if (value[0]=='p') {
  1627.       if (value[1]=='a')
  1628.      Printer_Type=4;             /* HP Paintjet (color)    */
  1629.       if ((value[1]=='o' || value[1]=='s')) {
  1630.      Printer_Type=5;             /* PostScript  SWT */
  1631.      if (value[2]=='h' || value[2]=='l')
  1632.         Printer_Type=6;
  1633.      }
  1634.       if (value[1]=='l')
  1635.      Printer_Type=7;             /* HP Plotter (semi-color) */
  1636.       }
  1637.    if (Printer_Type == 1)             /* assume low resolution */
  1638.       Printer_Resolution = 75;
  1639.    else
  1640.       Printer_Resolution = 60;
  1641.    if (EPSFileType > 0)              /* EPS save - force type 5 */
  1642.       Printer_Type = 5;
  1643.    if ((Printer_Type == 5) || (Printer_Type == 6))
  1644.       Printer_Resolution = 150;          /* PostScript def. res. */
  1645.    if ((value=strchr(value,'/'))) {
  1646.       if ((k=atoi(++value)) >= 0) Printer_Resolution=k;
  1647.       if ((value=strchr(value,'/'))) {
  1648.      if ((k=atoi(++value))> 0) LPTNumber = k;
  1649.      if (k < 0) {
  1650.         Print_To_File = 1;
  1651.         LPTNumber = 1;
  1652.         }
  1653.      }
  1654.       }
  1655.    return(0);
  1656. }
  1657.  
  1658.  
  1659.  
  1660. static void argerror(char *badarg)    /* oops. couldn't decode this */
  1661. {
  1662.    static char far argerrmsg1[]={"\
  1663. Oops. I couldn't understand the argument:\n  "};
  1664.    static char far argerrmsg2[]={"\n\n\
  1665. (see the Startup Help screens or documentation for a complete\n\
  1666.  argument list with descriptions)"};
  1667.    char msg[300];
  1668.    if (strlen(badarg) > 70) badarg[70] = 0;
  1669.    if (active_system == 0 /* DOS */
  1670.      && first_init)      /* & this is 1st call to cmdfiles */
  1671.       sprintf(msg,"%Fs%s%Fs",argerrmsg1,badarg,argerrmsg2);
  1672.    else
  1673.       sprintf(msg,"%Fs%s",argerrmsg1,badarg);
  1674.    stopmsg(0,msg);
  1675. }
  1676.  
  1677. void set_3d_defaults()
  1678. {
  1679.    ENTER_OVLY(OVLY_CMDFILES);
  1680.    RAY         = 0;
  1681.    BRIEF     = 0;
  1682.    ROUGH     = 30;
  1683.    WATERLINE = 0;
  1684.    ZVIEWER   = 0;
  1685.    XSHIFT    = 0;
  1686.    YSHIFT    = 0;
  1687.    xtrans    = 0;
  1688.    ytrans    = 0;
  1689.    LIGHTAVG  = 0;
  1690.    Ambient   = 20;
  1691.    RANDOMIZE = 0;
  1692.    haze      = 0;
  1693.    full_color= 0;
  1694.    back_color[0] = 51; back_color[1] = 153; back_color[2] = 200;
  1695.    if(SPHERE) {
  1696.       PHI1    =  180;
  1697.       PHI2    =  0;
  1698.       THETA1    =  -90;
  1699.       THETA2    =  90;
  1700.       RADIUS    =  100;
  1701.       FILLTYPE    = 2;
  1702.       XLIGHT    = 1;
  1703.       YLIGHT    = 1;
  1704.       ZLIGHT    = 1;
  1705.       }
  1706.    else {
  1707.       XROT    = 60;
  1708.       YROT    = 30;
  1709.       ZROT    = 0;
  1710.       XSCALE    = 90;
  1711.       YSCALE    = 90;
  1712.       FILLTYPE    = 0;
  1713.       if (active_system != 0)
  1714.      FILLTYPE = 2;
  1715.       XLIGHT    = 1;
  1716.       YLIGHT    = -1;
  1717.       ZLIGHT    = 1;
  1718.       }
  1719.     EXIT_OVLY;
  1720. }
  1721.  
  1722.